<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c"%>
<%@ taglib uri="http://www.longtop.com/intelliweb" prefix="e"%>
<%@ page isELIgnored="false"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>用户选择-SJH</title>
</head>
<e:View id="eView" designProperty="width: 1024px; height: 768px">
	<script type="text/javascript">SkinUtil.getSkin();</script>
	<script type="text/javascript">SkinUtil.getModuleSkin();</script>	
	
<div id="Invisual Controls" style="display: none;" style="min-height: 40px; background-color: LemonChiffon;" >
	<e:Dataset id="Dataset_User" datasetDefinition="DatasetDefinition_sys.dsd" datasetRef="dataset_user" pageSize="10" 
			loadDataCommand="Command_Load" allowMultiSelect="false">
		<e:Field name="userId" dataType="string" label="id" maxLength="32" />
		<e:Field name="userName" dataType="string" label="name" maxLength="200" />
		<e:Field name="orgId" dataType="string" label="orgId" maxLength="32" />
		<e:Field name="roleId" dataType="string" label="roleId" maxLength="32" />
		<e:Field name="orgName" dataType="string" label="orgName" maxLength="100" />
	</e:Dataset>
	 
	<e:Command id="Command_Load" action="com.longtop.framework.sys.user.web.UserDropdownAction" 
		method="load" showHintInfoOnSuccess="false" onBeforeExecute="cmd_load_onBeforeExecute(command)">
		<e:DatasetInfo name="info" dataset="Dataset_User" alwayRefreshClient="true" submitType="none"></e:DatasetInfo>
		<e:Parameter name="orgId" value=""></e:Parameter>
	</e:Command>
	<e:Command id="Command_Search" action="com.longtop.framework.sys.user.web.UserDropdownAction" 
		method="search" submitForm="true">
		<e:DatasetInfo name="info" dataset="Dataset_User" alwayRefreshClient="true" submitType="none"></e:DatasetInfo>
		<e:Parameter name="orgId" value=""></e:Parameter>
	</e:Command>
	
	<e:Dataset id="Dataset_Org" datasetDefinition="DatasetDefinition_sys.dsd" datasetRef="dataset_org" pageSize="-1" 
			loadDataCommand="Command_LoadOrg">
		<e:Field name="orgId" dataType="string" label="ID" maxLength="32" />
		<e:Field name="orgName" dataType="string" label="NAME" maxLength="200" />
		<e:Field name="parentOrgId" dataType="string" label="PARENT_ID" maxLength="32" />
		<e:Field name="sortNo" dataType="integer" label="SORT_NO" maxLength="4" />
		<e:Field name="remark" dataType="string" label="REMARK" maxLength="200" />
	</e:Dataset>
	
	<e:Command id="Command_LoadOrg" action="com.longtop.framework.sys.user.web.UserDropdownAction" 
		method="loadOrg" showHintInfoOnSuccess="false">
		<e:DatasetInfo name="info" dataset="Dataset_Org" alwayRefreshClient="true" submitType="none"></e:DatasetInfo>
	</e:Command>
	
	<e:Dataset id="Dataset_TeamUser" pageSize="-1">
		<e:Field name="userTeamId" dataType="string" label="群组ID" />
		<e:Field name="userTeamName" dataType="string" label="群组名称" />
	</e:Dataset>	 	
	<e:DataDropDown dataset="Dataset_TeamUser" id="DataDropDown_TeamUser" autoDropDown="false" fixed="false" checkInput="true" showColumnHeader="false"
		codeField="userTeamId" textField="userTeamName" visibleFields="userTeamName" showAddedItem="true" addedItemLabel="==选择员工群组==" addedItemValue=""
		onAfterSelect="DataDropDown_TeamUser_onAfterSelect(dropdown,record,text)">
	</e:DataDropDown>

</div>
<body style="overflow: hidden">
<e:Page id="ePage" action="com.longtop.framework.sys.user.web.UserDropdownAction" style="min-height: 80px; width: 100%; height: 100%;"
	onAfterLoadPage="ePage_onAfterLoadPage()" onBeforeLoadPage="ePage_onBeforeLoadPage()">
	<table style="width: 100%; height: 100%;" border="0" cellpadding="0" cellspacing="0">
		<tbody>
			<tr>
				<td align="left" valign="top">
					<e:Panel id="orgTree" style="width: 200px; height: 100%" caption="组织机构" captionIcon="/images/query_win.gif"
							captionStyle="color:#888888" allowFold="true" showArrowButton="false">
						<table style="text-align: left; width: 100%;height: 100%" border="0" cellpadding="1" cellspacing="1" align="center">
							<tbody>					
								<tr>
									<td align="center">
										<e:Text id="Text_teamUser" style="width:150px;" dropDown="DataDropDown_TeamUser"></e:Text>
									</td>
								</tr>								
								<tr>
									<td height="99%" colspan="1">
										<e:DataTree id="DataTree_Org" dataset="Dataset_Org" style="border-color:#3ABCFA;width: 100%; height: 100%; text-align: left"
											valueField="orgId"	parentField="parentOrgId" labelField="orgName" showRoot="false" rootLabel="组织机构" rootValue=" " 
											lazyLoading="true" useDefaultFolderIcon="true" contextMenuItems="expand,collapse" 
											nameField="orgId" onClickTreeNode="DataTree_Org_OnClick(node)">
										</e:DataTree>
									</td>
								</tr>							
							</tbody>
						</table>
					</e:Panel>
				</td>
				<td valign="top" width="100%">
					<e:Panel id="result" style="width: 100%; height: 100%" caption="员工列表" captionIcon="/images/list_win.gif"
							captionStyle="color:#888888" allowFold="false" showArrowButton="false">
						<table style="text-align: left; width: 100%;height: 100%" border="0" cellpadding="2" cellspacing="2" align="center">
								<tr>
									<td align="right" nowrap="nowrap">
										<e:Label id="Label_Id" caption="员工ID"></e:Label>
									</td>
									<td align="left">
										<e:Text id="Text_userId" style="width:100px;"></e:Text>
									</td>
									<td align="right" nowrap="nowrap">
										<e:Label id="Label_Name" caption="员工姓名"></e:Label>
									</td>
									<td align="left">
										<e:Text id="Text_userName" style="width:100px;"></e:Text>
									</td>
									<td align="left">
										<e:Button id="Button_Search" style="height: 22px; width: 50px;" caption="查询"  icon="/images/query.gif"  onClick="Button_Search_onClick()"></e:Button>
									</td>
								</tr>
								<tr>
									<td colspan="5">
										<e:Grid id="Grid_Result" style="width: 100%; height: 270px;" dataset="Dataset_User" showIndicator="false" 
												showIndex="false" readOnly="true" onDblClick="Grid_Result_onDblClick()">
											<e:Column name="userId" label="员工ID" field="userId" dataType="string" style="width:22%"></e:Column>	
											<e:Column name="userName" label="员工名" field="userName" dataType="string" style="width:32%"></e:Column>	
											<e:Column name="orgName" label="机构名称" field="orgName" dataType="string" style="width:46%"></e:Column>										
										</e:Grid>
									</td>
								</tr>
								<tr>
									<td colspan="5">
										<e:PageNavigator id="PageNavigator_User" dataset="Dataset_User" style="height: 27px;"></e:PageNavigator>
									</td>
								</tr>									
						</table>
					</e:Panel>
				</td>
			</tr>
		</tbody>
    </table>
</e:Page>
</body>
<script type="text/javascript">
	//init
	function ePage_onBeforeLoadPage(){
		var showSelect = "${param.showSelect}"
		if(showSelect == 'true'){
			Dataset_User.allowMultiSelect=true;
		}
	}
	function ePage_onAfterLoadPage(){
	
		var tree = $J("DataTree_Org");
	    if (!tree.currentNode) {
	    	tree.setCurrentNode();
		}
		Button_Search_onClick();
	}
	//翻页
	function cmd_load_onBeforeExecute(command){
		var record = $J("Dataset_Org").getCurrentRecord();
		if(record) {
			Command_Load.parameters.setValue("orgId",record.getValue("orgId"));
		}else{
			Command_Load.parameters.setValue("orgId","");
		}
	}
	//查询
	function Button_Search_onClick(){
		var record = $J("Dataset_Org").getCurrentRecord();
		if(record) {
			Command_Search.parameters.setValue("orgId",record.getValue("orgId"));
		}else{
			Command_Search.parameters.setValue("orgId","");
		}	
	    Command_Search.execute();
	}
	//双击确定，关闭弹出框
	function Grid_Result_onDblClick(){
		//通用 调用此页面
		var dropDown = $J(parent.LookupDropDown_User);
		if (dropDown != null) {
			dropDown.confirm();
		}
		
		//数据权限调用此页面
		dropDown = $J(parent.LookupDropDown_DataScope);
		if (dropDown != null) {
			dropDown.confirm();
		}
	}
	//点击节点-查询
	function DataTree_Org_OnClick(node){
		Button_Search_onClick();
	}
	
	//选择员工群组-查询：
	function DataDropDown_TeamUser_onAfterSelect(dropdown,record,text){
		Button_Search_onClick();
	}
</script>
</e:View>
</html>
